//
//  ZP_Extensions.swift
//  ZP_Tools
//
//  Created by zhangpoor on 17/3/3.
//  Copyright © 2017年 zhangpoor. All rights reserved.
//

import Foundation

//MARK:- < String相关 >
public extension String {
    
    func length() -> Int {
        var count:Int = 0;
        
        for _ in self.characters.indices {
            count = count + 1
        }
        
        return count
    }
    
    func indexOfChar(_ tChar:Character) -> String.Index? {
        
        var result:String.Index?
        
        for item in self.characters.indices {

            if self[item] == tChar
            {
                result = item
                break
            }
        }
        
        return result
    }
    
    
    
    /*
    func subStringWithString(_ tStr:String) -> String {
        
        //let s:String    = "zhangpoor://abc.ddd.com/sdf/dddd?&aaa=你好&bbb=buhaox"
        //let ss:String   = "zhangpoor://"
        let sss         = self.substring(from: tStr.endIndex)
        
        
        
        for index in sss.characters.indices {
            //print("i:\(index)  #\(sss[index])\n")
            let c = sss[index]
            if c == "?"
            {
                print("param:   \(sss.substring(from: sss.index(after: index)))\n")
                
                break
            }
        }
        
        
        return ""
    }
    */
    
}





